#ifndef CLUSTERGRAPH_H
#define CLUSTERGRAPH_H

#include <utility>
#include <vector>

//#include "clustersubset.h"

class PartitionGraph {
public:
	//bool isPartitioned;
	//std::vector<int> partition1;
	//std::vector<int> partition2;

	int numberOfClusters;
	std::vector< bool > connectionData;

	int numberOfPartitions;
	std::vector< std::vector< int > > partitions;

	bool isPartitioned() {
		return numberOfPartitions > 1;
	}

	PartitionGraph()
	{
		//isPartitioned = false;
		partitions = std::vector< std::vector< int > >();
		numberOfPartitions = 1;
		numberOfClusters = -1;
	}

	PartitionGraph( int numberOfClusters, bool* sharedClusters )
	{
		//isPartitioned = false;
		this->numberOfClusters = numberOfClusters; 
		for( int i = 0; i < numberOfClusters * numberOfClusters; i++ )
			connectionData.push_back( false );

		for( int i = 0; i < numberOfClusters; i++ )
		{
			for( int j = 0; j < numberOfClusters; j++ )
			{
				if( sharedClusters[ i ] && sharedClusters[ j ] ) 
					connect( i, j, true );
			}
		}
	}

	PartitionGraph( int numberOfClusters, std::vector< bool >& connectionData )
	{
		this->numberOfClusters = numberOfClusters;
		this->connectionData = std::vector<bool>();
		this->connectionData.resize( numberOfClusters * numberOfClusters );
		for( int i = 0; i < numberOfClusters * numberOfClusters; i++ ) {
			this->connectionData[ i ] = connectionData[ i ];
		}
	}

	void connect( int cluster1, int cluster2, bool connected );

	void update();

};
#endif
